package com.qww;

import java.util.Random;

public class Exec08 {

    public static void main(String[] args) {
        Random r = new Random(10);
        // 产生[2， 7)的整数值
        /*
        for (int i = 0; i < 2; i++) {
            int a = r.nextInt(7 - 2) + 2;
            switch(a) {
                case 2: System.out.println("222"); break;
                case 3: System.out.println("333"); break;
                case 4: System.out.println("444"); break;
                case 5: System.out.println("555"); break;
                default: System.out.println("666");
            }
        }
        /*
            运行结果:
            555
            222
        */
        for (int i = 0; i < 2; i++) {
            int a = r.nextInt(7 - 2) + 2;
            System.out.print("a=" + a + " : ");
            switch(a) {
                case 2: System.out.println("222");
                case 3: System.out.println("333");
                case 4: System.out.println("444");
                case 5: System.out.println("555");
                default: System.out.println("666");
            }
        }

        /*
            运行结果
            a=5 : 555
            666
            a=2 : 222
            333
            444
            555
            666
        */
    }
}